package com.ricchieri.bean;

import java.io.Serializable;
import java.sql.Time;
import java.util.Date;
import java.util.List;

import com.ricchieri.common.BusinessSettings;
import com.ricchieri.util.DateUtil;
import com.ricchieri.util.FacesUtil;

public class CancelMultipleReservationBean implements Serializable {

	private static final long serialVersionUID = -8719167212008678699L;
	private Date startDate;
	private Date finishDate;
	private String selectedReservationType;
	private String selectedCancelationType;
	private String selectedTrip;
	private List<String> selectedDays;
	private Date time;
	private String cancelationDescription;
	private Boolean block = Boolean.FALSE;
	private String blockMotive = "";
	
	public List<String> getSelectedDays() {
		return selectedDays;
	}

	public void setSelectedDays(List<String> selectedDays) {
		this.selectedDays = selectedDays;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	
	public Time getTimeWithFormat() {
		return DateUtil.convertToTime(time);
	}
	
	public String obtainDescriptionSelectedDays() {
		String result = "";
		for (String day : getSelectedDays()) {
			
			if(result.length() > 0) {
				result = result.concat(", ");
			}
			
			if(day.equals(BusinessSettings.DAY_FRIDAY)) {
				result = result.concat(FacesUtil.getMessage("friday"));
			} else 	if(day.equals(BusinessSettings.DAY_MONDAY)) {
				result = result.concat(FacesUtil.getMessage("monday"));
			} else 	if(day.equals(BusinessSettings.DAY_SATURDAY)) {
				result = result.concat(FacesUtil.getMessage("saturday"));
			} else 	if(day.equals(BusinessSettings.DAY_SUNDAY)) {
				result = result.concat(FacesUtil.getMessage("sunday"));
			} else 	if(day.equals(BusinessSettings.DAY_THURSDAY)) {
				result = result.concat(FacesUtil.getMessage("thursday"));
			} else 	if(day.equals(BusinessSettings.DAY_TUESDAY)) {
				result = result.concat(FacesUtil.getMessage("tuesday"));
			} else 	if(day.equals(BusinessSettings.DAY_WEDNESDAY)) {
				result = result.concat(FacesUtil.getMessage("wednesday"));
			} 
		}
		
		if(result.length() == 0) {
			result = FacesUtil.getMessage("all");
		}
		
		return result;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getFinishDate() {
		return finishDate;
	}

	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}

	public String getSelectedReservationType() {
		return selectedReservationType;
	}

	public void setSelectedReservationType(String selectedReservationType) {
		this.selectedReservationType = selectedReservationType;
	}

	public String getSelectedCancelationType() {
		return selectedCancelationType;
	}

	public void setSelectedCancelationType(String selectedCancelationType) {
		this.selectedCancelationType = selectedCancelationType;
	}

	public String getSelectedTrip() {
		return selectedTrip;
	}

	public void setSelectedTrip(String selectedTrip) {
		this.selectedTrip = selectedTrip;
	}

	public String getCancelationDescription() {
		return cancelationDescription;
	}

	public void setCancelationDescription(String cancelationDescription) {
		this.cancelationDescription = cancelationDescription;
	}

	public Boolean getBlock() {
		return block;
	}

	public void setBlock(Boolean block) {
		this.block = block;
	}

	public String getBlockMotive() {
		return blockMotive;
	}

	public void setBlockMotive(String blockMotive) {
		this.blockMotive = blockMotive;
	}
}
